﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Duoease.ContainerModel.Entity
{
    public class HorizontalFridge : FridgeModel
    {
            #region 构造函数
        public HorizontalFridge()
        {
            this.Title = "冰箱";
            this.ElementType = "fridge";
            this.TagName = "HorizontalFridge";
        }
        public HorizontalFridge(string tile)
        {
            this.Title = tile;
            this.ElementType = "fridge";
            this.TagName = "HorizontalFridge";
        }
        public HorizontalFridge(int row, int column, string tile)
        {
            Row = row;
            Column = column;
            this.Title = tile;
            this.ElementType = "fridge";
            this.TagName = "HorizontalFridge";
        }
        public HorizontalFridge(int row, int column, Color surfaceColor, int alpha, string tile)
        {
            Row = row;
            Column = column;
            SurfaceColor = surfaceColor;
            Alpha = alpha;
            this.Title = tile;
            this.ElementType = "fridge";
            this.TagName = "HorizontalFridge";
        }
        public HorizontalFridge(int row, int column, Color surfaceColor, int alpha, Color lineColor, int lineWidth, string tile)
        {
            Row = row;
            Column = column;
            SurfaceColor = surfaceColor;
            Alpha = alpha;
            LineColor = lineColor;
            LineWidth = lineWidth;
            this.Title = tile;
            this.ElementType = "fridge";
            this.TagName = "HorizontalFridge";
        }
        #endregion
        /**
  * 功能：图形绘制
  * 
  * */
        public override void Draw()
        {
            if (Row < 1 || Column < 1)
            {
                return;
            }
            g.Clear(BackGround);
            //this.Location.X = (this.CanvasWidth - this.ContainerWidth)/2 > ContainerWidth / (Column + 2) ? ContainerWidth / (Column + 2) : (this.CanvasWidth - this.ContainerWidth)/2;
            //this.Location.Y = (this.CanvasHeight - this.ContainerHeight)/2 < ContainerHeight / (Row + 2) ? ContainerHeight / (Row + 2) : (this.CanvasHeight - this.ContainerHeight)/2;

            this.Location.X = ContainerWidth / (Column + 4);
            this.Location.Y = ContainerHeight / (Row + 1);
            if (UnitWidth == 0)
            {
                UnitWidth = ContainerWidth / (Column + 2);
            }
            if (UnitHeight == 0)
            {
                UnitHeight = ContainerHeight / (Row + 2);
            }
            JoinIceModel(g, this.Location, Row, Column, UnitWidth, UnitHeight, Alpha, SurfaceColor, LineColor, LineWidth);
        }
    }
}
